#include "ExpressionEquals.h"
#include <QDebug>

#include "UI/ModRun/Output/FactoryOutput.h"

ExpressionEquals::ExpressionEquals(ExpressionAll* pExpressionAll)
{
    m_charOpr = '=';
    if (pExpressionAll)
    {
        pExpressionAll->RegisterOpr(m_charOpr, this);
    }

    m_pExpAll = pExpressionAll;
}

ExpressionEquals::~ExpressionEquals()
{

}


// 通过 InterFaceExpression 继承
uint64_t ExpressionEquals::Interpreter(ContextInterpreter& context)
{
    QString strOutput = "ExpressionEquals::Interpreter:执行新接口'='";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }

    if (m_pExpAll)
    {
        return m_pExpAll->Interpreter(context);
    }
    return context.m_uValue;
}
